Integrand size = 23, antiderivative size = 132 \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}-\frac {\left (a^2-b^2\right ) d (d \cot (e+f x))^{-1+n} \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (-1+n),\frac {1+n}{2},-\cot ^2(e+f x)\right )}{f (1-n)}-\frac {2 a b (d \cot (e+f x))^n \operatorname {Hypergeometric2F1}\left (1,\frac {n}{2},\frac {2+n}{2},-\cot ^2(e+f x)\right )}{f n} \]
a^2*d*(d*cot(f*x+e))^(-1+n)/f/(1-n)-(a^2-b^2)*d*(d*cot(f*x+e))^(-1+n)*hype rgeom([1, -1/2+1/2*n],[1/2+1/2*n],-cot(f*x+e)^2)/f/(1-n)-2*a*b*(d*cot(f*x+ e))^n*hypergeom([1, 1/2*n],[1+1/2*n],-cot(f*x+e)^2)/f/n
Time = 0.52 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.81 \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=-\frac {d (d \cot (e+f x))^{-1+n} \left (-\left (\left (a^2-b^2\right ) n \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (-1+n),\frac {1+n}{2},-\cot ^2(e+f x)\right )\right )+a \left (a n+2 b (-1+n) \cot (e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {n}{2},\frac {2+n}{2},-\cot ^2(e+f x)\right )\right )\right )}{f (-1+n) n} \]
-((d*(d*Cot[e + f*x])^(-1 + n)*(-((a^2 - b^2)*n*Hypergeometric2F1[1, (-1 + n)/2, (1 + n)/2, -Cot[e + f*x]^2]) + a*(a*n + 2*b*(-1 + n)*Cot[e + f*x]*H ypergeometric2F1[1, n/2, (2 + n)/2, -Cot[e + f*x]^2])))/(f*(-1 + n)*n))
Time = 0.64 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.08, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.391, Rules used = {3042, 4156, 3042, 4026, 3042, 4021, 3042, 3957, 278}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int (a+b \tan (e+f x))^2 (d \cot (e+f x))^n \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (e+f x))^2 (d \cot (e+f x))^ndx\) |
\(\Big \downarrow \) 4156 |
\(\displaystyle d^2 \int (d \cot (e+f x))^{n-2} (b+a \cot (e+f x))^2dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle d^2 \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2} \left (b-a \tan \left (e+f x+\frac {\pi }{2}\right )\right )^2dx\) |
\(\Big \downarrow \) 4026 |
\(\displaystyle d^2 \left (\int (d \cot (e+f x))^{n-2} \left (-a^2+2 b \cot (e+f x) a+b^2\right )dx+\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}\right )\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle d^2 \left (\int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2} \left (-a^2-2 b \tan \left (e+f x+\frac {\pi }{2}\right ) a+b^2\right )dx+\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}\right )\) |
\(\Big \downarrow \) 4021 |
\(\displaystyle d^2 \left (-\left (a^2-b^2\right ) \int (d \cot (e+f x))^{n-2}dx+\frac {2 a b \int (d \cot (e+f x))^{n-1}dx}{d}+\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}\right )\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle d^2 \left (-\left (a^2-b^2\right ) \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2}dx+\frac {2 a b \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-1}dx}{d}+\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}\right )\) |
\(\Big \downarrow \) 3957 |
\(\displaystyle d^2 \left (\frac {d \left (a^2-b^2\right ) \int \frac {(d \cot (e+f x))^{n-2}}{\cot ^2(e+f x) d^2+d^2}d(d \cot (e+f x))}{f}-\frac {2 a b \int \frac {(d \cot (e+f x))^{n-1}}{\cot ^2(e+f x) d^2+d^2}d(d \cot (e+f x))}{f}+\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}\right )\) |
\(\Big \downarrow \) 278 |
\(\displaystyle d^2 \left (-\frac {\left (a^2-b^2\right ) (d \cot (e+f x))^{n-1} \operatorname {Hypergeometric2F1}\left (1,\frac {n-1}{2},\frac {n+1}{2},-\cot ^2(e+f x)\right )}{d f (1-n)}+\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {2 a b (d \cot (e+f x))^n \operatorname {Hypergeometric2F1}\left (1,\frac {n}{2},\frac {n+2}{2},-\cot ^2(e+f x)\right )}{d^2 f n}\right )\) |
d^2*((a^2*(d*Cot[e + f*x])^(-1 + n))/(d*f*(1 - n)) - ((a^2 - b^2)*(d*Cot[e + f*x])^(-1 + n)*Hypergeometric2F1[1, (-1 + n)/2, (1 + n)/2, -Cot[e + f*x ]^2])/(d*f*(1 - n)) - (2*a*b*(d*Cot[e + f*x])^n*Hypergeometric2F1[1, n/2, (2 + n)/2, -Cot[e + f*x]^2])/(d^2*f*n))
3.9.81.3.1 Defintions of rubi rules used
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( -b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] && !IGtQ[p, 0] && (ILtQ[p, 0 ] || GtQ[a, 0])
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d Subst[Int [x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && !IntegerQ[n]
Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[c Int[(b*Tan[e + f*x])^m, x], x] + Simp[d/b Int [(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ[c^ 2 + d^2, 0] && !IntegerQ[2*m]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*( m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e + f* x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] && !LeQ [m, -1] && !(EqQ[m, 2] && EqQ[a, 0])
Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x _)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p) Int[(d*Cot[e + f*x])^(m - n*p )*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && !IntegerQ[m] && IntegersQ[n, p]
\[\int \left (d \cot \left (f x +e \right )\right )^{n} \left (a +b \tan \left (f x +e \right )\right )^{2}d x\]
\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]
\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=\int \left (d \cot {\left (e + f x \right )}\right )^{n} \left (a + b \tan {\left (e + f x \right )}\right )^{2}\, dx \]
\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]
\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]
Timed out. \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx=\int {\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n\,{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2 \,d x \]